package com.sunny.ynhz.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.sunny.ynhz.R;
import com.sunny.ynhz.utils.TypeAndStatusUtil;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;

/**
 * Created by huhuan123 on 2018/8/16.
 *
 * @describe TODO
 */

public class ProblemTypeAdapter extends BaseAdapter {
    private final LinkedHashMap<String, String> problemTpye;
    Context context;
    List<String> mList;

    public ProblemTypeAdapter(Context context, List<String> mList) {
        problemTpye = TypeAndStatusUtil.getProblemTpye();
        this.context = context;
        Set<String> strings = problemTpye.keySet();
        Iterator<String> iterator = strings.iterator();
        while (iterator.hasNext()) {
            String next = iterator.next();
            mList.add(next);
        }
        this.mList = mList;
    }

    @Override
    public int getCount() {
        return problemTpye.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View currentView = LayoutInflater.from(context).inflate(R.layout.item_problem_type, null);
        TextView tv_problem_type = currentView.findViewById(R.id.tv_problem_type);
        tv_problem_type.setText(problemTpye.get(mList.get(i)));
        return currentView;
    }
}
